<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS代码设置节点的属性</title>
</head>
<body>
<script type="text/javascript">
  window.onload=function () {
    document.getElementById("btn").onclick=function () {
      var mytext=document.getElementById("mytext");
      mytext.type="checkbox";
    }
  }
</script>
<input type="text" id="mytext">
<input type="button" value="将文本框改为复选框" id="btn">
</body>
</html>